package com.opensms.eventLogFacade.actions;

import java.sql.Connection;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.opensms.eventLogFacade.dao.SQLEventLogDAO;
import com.opensms.eventLogFacade.dao.StandardSQLEventLogDAO;
import com.opensms.eventLogFacade.vo.EventLogVO;
import com.util.exceptions.InternalErrorException;
import com.util.exceptions.ModelException;
import com.util.sql.TransactionalPlainAction;

public class AddEventLogAction implements TransactionalPlainAction {
	private static Log log = LogFactory.getLog(AddEventLogAction.class);
	
	private EventLogVO vo;

	public AddEventLogAction(EventLogVO vo) {
		this.vo = vo;
	}

	public Object execute(Connection connection) throws ModelException, InternalErrorException {
		try{
			SQLEventLogDAO dao = new StandardSQLEventLogDAO();
			EventLogVO vo = dao.create(connection, this.vo);
			return vo;
		}catch (Exception e){
			throw new InternalErrorException(e);
		}
	}
}
